﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Reflection;
using System.Reflection.Emit;

namespace WPFInterview
{
    public class ReflectionQuestionTest : IQuestion
    {
        public string TestName
        {
            get { return ".NET - Reflection"; }
        }

        public UserControl getUserControl()
        {
            return new ReflectionQuestion();
        }
    }

    /// <summary>
    /// Interaction logic for Reflection.xaml
    /// </summary>
    public partial class ReflectionQuestion : UserControl
    {
        public ReflectionQuestion()
        {
            InitializeComponent();

            // Initial the list box
            InitialListBox();
        }

        private void InitialListBox()
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            Type[] types = assembly.GetTypes();           
            Module[] modules = assembly.GetModules();

            this._listReflectionTypes.ItemsSource = types;
            this._listReflectionTypes.DisplayMemberPath = "Name";

            this._listReflectionModules.ItemsSource = modules;
            this._listReflectionModules.DisplayMemberPath = "Name";
        }
    }
}
